﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class BackpackItemInfo : MonoBehaviour
{
    /// <summary>
    /// quality icon. 0: white 1:green 2:yellow 3:red
    /// </summary>
    public Image BgIcon;
    public Image Icon;
    public Text Count;
    public GameObject IsChip;

    public BackpackItem itemInfo;


    public void SetData(BackpackItem iteminfo)
    {
        this.itemInfo = iteminfo;
        this.Icon.sprite = Resources.Load<Sprite>("Textures/Item/" + iteminfo.ItemIcon);
        this.BgIcon.sprite = Resources.Load<Sprite>("Textures/Package/" + iteminfo.ItemBgIcon);
        switch (iteminfo.ItemQua)
        {
            case 1:
                this.BgIcon.color = Color.green;
                break;
            case 2:
                this.BgIcon.color = Color.yellow;
                break;
            case 3:
                this.BgIcon.color = Color.red;
                break;
            default:
            case 0:
                this.BgIcon.color = Color.white;
                break;
        }
        this.Count.text = iteminfo.ItemCount.ToString();
        this.IsChip.SetActive(iteminfo.MItemType == BackpackItem.ItemType.Chips);
    }
}
